package com.tsk.example.api.controller;

import com.tsk.example.WithSpringTestBase;
import org.junit.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

/**
 * @author: 黄嘉振
 * @create: 2023/3/10 14:37
 * @description:
 **/
@AutoConfigureMockMvc
public abstract class BaseController extends WithSpringTestBase {
    @Autowired
    protected WebApplicationContext webApplicationContext;

    @Autowired
    protected MockMvc mockMvc;

    @Before
    public void setUp() throws Exception {
        System.out.println("------------start----------------");
        mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
    }
}
